;(function($){
	this.addressObj = function(){
		var addressBlock;
		var changeAddr;
		var deleteAddrBtn;
		var confirmDelBtn;
		var addressDialog;
		var dialogClose;
		var addAddressBtn;
		
		var initData = function(){
			
		};
		
		var loadEvent = function(){
			//移入大框button文本变蓝
			addressBlock.hover(function(){
				$(this).find('.desktop-addressblock-buttons button').css('color','#0089dc');
			},function(){
				$(this).find('.desktop-addressblock-buttons button').css('color','#bbb');
			})
			changeAddr.on('click',showChangeInfo);//点击修改按钮跳出修改框
			
			addAddressBtn.on('click',showChangeInfo)//点击增加按钮跳出增加地址框
			
			deleteAddrBtn.on('click',deleteAddr);
			
			//关闭修改地址框
			dialogClose.on('click',function(){
				addressDialog.hide();
				$('.blackbox').remove();
			})
			
			//是否删除地址
			confirmDelBtn.on('click',confirmDel);
		};
		
		var showChangeInfo = function(){
			$('body').append('<div class="blackbox"></div>');
			addressdiv.show();
		}
		
		var deleteAddr = function(){
			var _parent = $(this).parents('.desktop-addressblock');
			_parent.find('.desktop-addressblock-removebuttons').removeClass('ng-hide');
			_parent.find('.desktop-addressblock-mask').removeClass('ng-hide');
			
		}
		
		var confirmDel = function(){
			var _parent = $(this).parents('.desktop-addressblock');
			if($(this).hasClass('confirmdelete')){
				$(this).parents('.desktop-addressblock').remove();
				//后台删除地址
			}else{
				_parent.find('.desktop-addressblock-removebuttons').addClass('ng-hide');
				_parent.find('.desktop-addressblock-mask').addClass('ng-hide');
			}
		}
		
		
		return {
			run: function(){
				addressBlock = $('.desktop-addressblock');
				changeAddr = $('.desktop-addressblock-buttons button:first-of-type');
				deleteAddrBtn = $('.desktop-addressblock-buttons button:last-of-type');
				confirmDelBtn = $('.desktop-addressblock-removebuttons button');
				dialogClose = $('.addressdialog-close,.addressform-buttons button:last-of-type');
				addressDialog = $('.addressdialog');
				addAddressBtn = $('.desktop-addressblock.desktop-addressblock-addblock');
				initData();
				loadEvent();
			}
		}
	}();
	
//	changePwd.run();
})(jQuery);
